package com.springboot.mybatis.repository.provider;

import org.apache.ibatis.jdbc.SQL;
import org.springframework.util.StringUtils;

/**
 * @version V1.0
 * @program: mybatis
 * @description
 * @author: 张要廷<zhang_yt @ suixingpay.com>
 * @create: 2019/10/22 10:41
 **/
public class UserRepositoryProvider {

    public String getUserById(String userId) {
        String sql = new SQL() {
            {
                SELECT("id, login_name, pwd, user_name, age");
                FROM("xh_user");
                if (!StringUtils.isEmpty(userId)) {
                    WHERE("id = #{userId}");
                }

            }
        }.toString();
        return sql;
    }
}
